package com.lightsaber.trade.cloth.dao.category;

import java.util.List;

import org.springframework.stereotype.Component;

import com.lightsaber.trade.core.dao.BaseDao;
import com.lightsaber.trade.cloth.entity.category.CategoryOwner;

@Component
public class CategoryOwnerDao extends BaseDao<CategoryOwner, String> {
    /**
     * delete by categoryNodeId
     */
    public void deleteByCategoryNodeId(final String categoryNodeId) {
        this.createQuery("delete from CategoryOwner c where c.categoryNode.id=?", categoryNodeId)
                .executeUpdate();
    }

    public List<CategoryOwner> findByCategoryNodeId(final String categoryNodeId) {
        return eq("categoryNode.id", categoryNodeId).list();
    }
}
